<div id="network-supply-transport-bar4" style="height: 100%">

</div>

<script type="text/javascript">
    function loadbar4(branchCenter,primarySale) {
        $.ajax({
            url: "#springUrl('/network/supply/transport/bar4')",
            data: {branchCenter: branchCenter, primarySale: primarySale},
            type: "POST",
            success: function (text) {
                var d = JSON.parse(text);
                if (d.success && d.data) {
                    var myChart = echarts.init(document.getElementById('network-supply-transport-bar4'), 'macarons');
                    myChart.setOption({
                        title: {
                            text: '一天内所有车辆总油耗：元'
                            , show: false
                        },
                        tooltip: {
                            trigger: 'axis',
                            axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                                type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                            }
                        },
                        toolbox: {
                            show: true,
                            feature: {
                                mark: {show: true},
                                saveAsImage: {show: true}
                            }
                        },
                        xAxis: [
                            {
                                type: 'category',
                                data: d.data.time,
                                axisLabel: {
                                    textStyle:{
                                        color:"#595959"
                                    }
                                },
                                axisLine: {
                                    show: false
                                },
                                axisTick: {
                                    show: false
                                },
                            }
                        ],
                        yAxis: [
                            {
                                type: 'value',
                                boundaryGap: [0, 0.1],
                                axisLine: {
                                    show: false
                                },
                                axisTick: {
                                    show: false
                                },
                                axisLabel: {
                                    formatter: function(value){
                                        var var1=value*1;
                                        return var1;
                                    },
                                    textStyle:{
                                        color:"#595959"
                                    }
                                },
                                splitLine:{
                                    show:true
                                },
                                splitArea: {
                                    show:true,
                                    areaStyle: {
                                        color: ['rgba(0,0,0,0)', 'rgba(0,0,0,0)']
                                    }
                                },

                            }
                        ],
                        color:['#0fa99d','#4472c4','#d9d9d9','#787473','#c9eee7','#e7a14c',
                            '#4472c4','#40C2F0','#9EC678','#BDD7EE','#A5A5A5',
                            '#8497B0','#EBEBEB','#015E7F','#415168'],
                        series: [
                            {
                                name: '延误程度',
                                type: 'bar',
                                barWidth:40,
                                data: d.data.days,
                                itemStyle: {
                                    normal: {
                                        //好，这里就是重头戏了，定义一个list，然后根据所以取得不同的值，这样就实现了，
                                        color: function(params) {
                                            // build a color map as your need.
                                            var colorList = [
                                                '#0fa99d','#d9d9d9','#787473','#c9eee7','#e7a14c',
                                                '#4472c4','#9BCA63','#FAD860','#F3A43B','#60C0DD',
                                                '#D7504B','#C6E579','#F4E001','#F0805A','#26C0C0'
                                            ];
                                            return colorList[params.dataIndex]
                                        },
                                        //以下为是否显示，显示位置和显示格式的设置了
                                    }}
                            }, {
                                name: '准时占比',
                                type: 'pie',
                                center: ['75%', '15%'],
                                radius: '28%',
                                z: 10,
                                data: [
                                    {name: '准时', value: d.data.ontime},
                                    {name: '延误', value: d.data.delay}
                                ]
                            }
                        ]
                    });
                }else{
                    var div1="<div type='text' style='padding-top:18%' class=' text-center '>"+d.message+"</div>";
                    $("#network-supply-transport-bar4").empty();
                    $("#network-supply-transport-bar4").prepend(div1);
                }
            }
        });
    }

</script>